package cn.openea.perpartner.timeline.web.controller;


import cn.openea.perpartner.common.core.web.controller.BaseController;
import cn.openea.perpartner.common.core.web.domain.AjaxResult;
import cn.openea.perpartner.common.core.web.page.TableDataInfo;
import cn.openea.perpartner.timeline.web.entity.ArcData;
import cn.openea.perpartner.timeline.web.entity.InsData;
import cn.openea.perpartner.timeline.web.entity.dto.SearchDto;
import cn.openea.perpartner.timeline.web.entity.dto.UserGroupDto;
import cn.openea.perpartner.timeline.web.service.ArcDataService;
import cn.openea.perpartner.timeline.web.service.InsDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * (ArcData)表控制层
 *
 * @author Weird077
 * @since 2022-12-11 22:16:28
 */
@Api(tags = "工单时间轴")
@RestController
@RequestMapping("/timeline")
public class TimelineController extends BaseController {

    @Resource
    private InsDataService insService;
    @Resource
    private ArcDataService arcService;

    @ApiOperation(value = "时间轴-ins", notes = "分页查询所有数据 -ins")
    @PostMapping("/ins/list")
    public TableDataInfo selectInsAll(@RequestBody  SearchDto dto) {
        startPage();
        List<InsData> list = insService.selectAll(dto);
        return getDataTable(list);
    }
    @ApiOperation(value = "时间轴-arc", notes = "分页查询所有数据 -arc")
    @PostMapping("/arc/list")
    public TableDataInfo selectArcAll(@RequestBody  SearchDto dto) {
        startPage();
        List<ArcData> list = arcService.selectAll(dto);
        return getDataTable(list);
    }
    @ApiOperation(value = "新增-ins", notes = "插入时间轴数据 -ins")
    @PostMapping("/ins/save")
    public AjaxResult save(@RequestBody InsData insData) {

        return AjaxResult.success("操作成功",insService.save(insData));
    }

    @ApiOperation(value = "用户组-ins", notes = "查询工单用户 - ins")
    @PostMapping("/ins/user/group")
    public TableDataInfo selectInsUserGroup(@RequestBody  SearchDto dto) {
        startPage();
        List<UserGroupDto> list = insService.selectUserGroup(dto);
        return getDataTable(list);
    }
    @ApiOperation(value = "用户组-arc", notes = "查询工单用户 - arc")
    @PostMapping("/arc/user/group")
    public TableDataInfo selectAcrUserGroup(@RequestBody  SearchDto dto) {
        startPage();
        List<UserGroupDto> list = arcService.selectUserGroup(dto);
        return getDataTable(list);
    }

}

